package cn.tx.doubaodemo.controller;

import cn.tx.doubaodemo.common.result.IResult;
import cn.tx.doubaodemo.service.ChatService;
import cn.tx.doubaodemo.vo.AnswerVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter;

@RestController
@RequestMapping("/chat")
public class ChatController {

    @Autowired
    private ChatService chatService;

    @PostMapping("/doubao")
    public IResult<AnswerVO> getDoubaoAnswer(@RequestBody String input) {
        return IResult.success(chatService.getStandardAnswerDoubao(input));
    }

    @GetMapping("/doubao/stream")
    public ResponseBodyEmitter getDoubaoAnswerStream(@RequestParam("input") String input) {
        return chatService.getStreamAnswerDoubao(input);
    }

    @PostMapping("/deepSeek")
    public IResult<AnswerVO> getDeepSeekAnswer(@RequestBody String input) {
        return IResult.success(chatService.getDeepSeekAnswer(input));
    }


}
